import info
import os
import shells

class subinfo(info.infoclass):
    def setTargets( self ):
        self.targets['0.6.1']       = 'http://pidgin-dbus.googlecode.com/files/pidgin-dbus-0.6.1+devel.tar.gz' 
        self.targetInstSrc['0.6.1'] = 'pidgin-dbus-0.6.1+devel' 
        #self.targetDigests['0.6.1'] = ['<HERE IS SHA1SUM>']

        self.defaultTarget = '0.6.1'

    def setDependencies( self ):
        self.hardDependencies['virtual/base'] = 'default'
        self.hardDependencies['dev-util/msys'] = 'default'
        #self.hardDependencies['testing/pkg-config'] = 'default'
        self.hardDependencies['testing/pthreads-win32'] = 'default'
        self.hardDependencies['win32libs-bin/dbus'] = 'default'
        self.hardDependencies['win32libs-sources/dbus-c++-src'] = 'default'

from Package.AutoToolsPackageBase import *

class Package(AutoToolsPackageBase):
    def __init__( self, **args ):
        self.subinfo = subinfo()
        self.shell = MSysShell()
	pkgconfigpath = self.shell.toNativePath( os.path.join( os.environ.get("KDEROOT"), "devel", "pkgconfig" ) )
        cppflags= " -I%s " % self.shell.toNativePath( os.path.join( os.environ.get("KDEROOT"), "include" ) )
        ldflags= " -L%s -lws2_32 -lpthread " % self.shell.toNativePath( os.path.join( os.environ.get("KDEROOT"), "lib" ) )
        print "\n======",pkgconfigpath,"======\n"
        self.subinfo.options.configure.defines=" CPPFLAGS='%s' LDFLAGS='%s' PKG_CONFIG_PATH='%s' " % ( cppflags, ldflags, pkgconfigpath )
        self.subinfo.options.configure.bootstrap = True
        AutoToolsPackageBase.__init__(self)


    def configure( self, cflags="", ldflags=""):
        # Check whether compiler is mingw or not...
        if self.compiler() != "mingw" and self.compiler() != "mingw4":
            utils.die("This package is currently only compiled with mingw.")

        #autogen = os.path.join(self.sourceDir(),"autogen.sh")
        #msysbin = self.shell.toNativePath( os.path.join( self.shell.msysdir, "bin" ) )
        #self.shell.execute( self.sourceDir(), "PATH=$PATH:/bin/ bootstrap", "" )

        return AutoToolsPackageBase.configure( self, cflags, ldflags )
       

if __name__ == '__main__':
    Package().execute()
